// Linear search of array item
// Date 21:23 12/10/2016
// By Ben a.k.a DreamVB

#include <iostream>

using namespace std;
using std::cout;
using std::endl;
using std::cin;

int main(int argc, char *argv[]){
	const int size = 6;
	int nums[size] = { 8, 6, 10, 12, 3, 9 };

	int i = 0;
	int idx = -1;
	int find = 12;

	//Print out items
	cout << "Source : ";
	while (i < size){
		cout << nums[i] << " ";
		i++;
	}
	i = 0;

	//Try and find the item in the array
	cout << endl;
	while (i < size){
		if (nums[i] == find){
			idx = i;
			break;
		}
		i++;
	}

	if (idx != -1){
		cout << find << " was found at index : " << idx << endl;
	}
	else{
		cout << find << " was not found." << endl;
	}

	system("pause");
	return 0;
}